/*
 *   Copyright 2021 zzh
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 *
 */

package com.aduib.boot.common.zookeeper;

import org.apache.curator.RetryPolicy;
import org.apache.curator.retry.RetryNTimes;

/**
 * @description: Zkconfig
 * @author: zzh
 * @date: 2022/1/26 14:47
 */
public class ZkConfig {

    private int sessionTimeOut=30*1000;

    private int connectionTimeOut=3*1000;

    private String address="127.0.0.1:2181";

    private String namespace="";

    private RetryPolicy retryPolicy=new RetryNTimes(1,1000);

    private String authority="";


    public ZkConfig() {
    }

    public ZkConfig(String address) {
        this.address = address;
    }

    public ZkConfig(String address, String authority) {
        this.address = address;
        this.authority = authority;
    }

    public ZkConfig(String address, RetryPolicy retryPolicy) {
        this.address = address;
        this.retryPolicy = retryPolicy;
    }

    public ZkConfig(String address, String namespace, String authority) {
        this.address = address;
        this.namespace = namespace;
        this.authority = authority;
    }

    public ZkConfig(String address, String namespace, RetryPolicy retryPolicy, String authority) {
        this.address = address;
        this.namespace = namespace;
        this.retryPolicy = retryPolicy;
        this.authority = authority;
    }

    public ZkConfig(int sessionTimeOut, int connectionTimeOut, String address, String namespace, RetryPolicy retryPolicy, String authority) {
        this.sessionTimeOut = sessionTimeOut;
        this.connectionTimeOut = connectionTimeOut;
        this.address = address;
        this.namespace = namespace;
        this.retryPolicy = retryPolicy;
        this.authority = authority;
    }

    public int getSessionTimeOut() {
        return sessionTimeOut;
    }

    public void setSessionTimeOut(int sessionTimeOut) {
        this.sessionTimeOut = sessionTimeOut;
    }

    public int getConnectionTimeOut() {
        return connectionTimeOut;
    }

    public void setConnectionTimeOut(int connectionTimeOut) {
        this.connectionTimeOut = connectionTimeOut;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getNamespace() {
        return namespace;
    }

    public void setNamespace(String namespace) {
        this.namespace = namespace;
    }

    public RetryPolicy getRetryPolicy() {
        return retryPolicy;
    }

    public void setRetryPolicy(RetryPolicy retryPolicy) {
        this.retryPolicy = retryPolicy;
    }

    public String getAuthority() {
        return authority;
    }

    public void setAuthority(String authority) {
        this.authority = authority;
    }
}
